<?php

class DownLoadForm extends CFormModel
{

    public $code;





	
	//表单验证规则
	public function rules()
	{
		return array(

        );
	}




	


	public function add($id)
	{

        $cardLog = ShopCardOutLog::model()->findByPk($id);

        $all = ShopCardLog::model()->findAll("log_id=:log_id",["log_id"=>$cardLog->id]);

        $arr = [];
        $aes = new Aes();
        foreach ($all as $r) {
            $arr[] = array(
                "code_str" => $aes->decrypt($r->code_str),
                "face_value" => $r->face_value / 100,
            );
        }
        ShopCardLog::excel($arr,$cardLog->create_time);
        Yii::app()->session['codestr'] = "";
	}
}